//
// Created by baigui on 21-6-30.
//

#include "android/log.h"
#include "stdio.h"
#include "string.h"

#ifndef SIMPLE_PLAYER_LOG_H
#define SIMPLE_PLAYER_LOG_H

#ifndef TAG
#define TAG "DemoPlayer"
#endif

#ifdef DISMISS_LOG
#define LOGV(...) do{}while(0)
#define LOGD(...) do{}while(0)
#define LOGI(...) do{}while(0)
#define LOGW(...) do{}while(0)
#define LOGE(...) do{}while(0)
#else
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
#endif

static void hexdump_data( const uint8_t *data,size_t offset,
                         size_t n)
{
    unsigned int i, j;

    char str1[64] = { 0 };

    for (i = 0; i < n; i += 16) {
        memset(str1,0,64);
        for (j = 0; j < 16; j++) {
            if (i+j < n)
                sprintf(str1, "%s %02x", str1, data[offset + i+j]);
//                fprintf(stderr,"%02x", data[offset + i+j]);
            /* No separator */
        }
        LOGD("%08x %s",i,str1);
    }
}

#endif //SIMPLE_PLAYER_LOG_H
